package com.graduate.examapp.model

import android.util.Log
import com.graduate.examapp.entity.AddUserParam
import com.graduate.examapp.entity.Teacher
import com.graduate.examapp.entity.StatusParam
import com.graduate.examapp.request.Response
import com.graduate.examapp.request.RetrofitRequest
import okhttp3.MultipartBody
import retrofit2.http.Part

class TeacherRepository {
    private val serviceEndpoint = RetrofitRequest.getService()

    suspend fun fetchTeacherData(insName: String): Response<MutableList<Teacher>> {
        return serviceEndpoint.fetchTeachers(insName)
    }

    suspend fun delTeacher(teacherDelParam: StatusParam): Response<Boolean> {
        return serviceEndpoint.delTeacher(teacherDelParam)
    }

    suspend fun changeStatus(statusParam: StatusParam): Response<Boolean> {
        return serviceEndpoint.changeStatus(statusParam)
    }

    suspend fun addTeacher(addUserParam: AddUserParam): Response<Boolean> {
        return serviceEndpoint.addTeacher(addUserParam)
    }

    suspend fun addTeacherBatch(teacherFile: MultipartBody.Part): Response<Boolean> {
        return serviceEndpoint.uploadOneFile(teacherFile)
    }
}